<script setup>
import { queryCategory } from '@/api/category';
import { onMounted, ref } from 'vue';

const data = ref([]);
const defaultProps = {
  children: 'catematerList',
  label: 'name'
};

const LoadCategory = async () => {
  const res = await queryCategory();
  console.log(res);
  data.value = res;
};

onMounted(() => {
  LoadCategory();
});
</script>

<template>
  
    <el-tree
      style="max-width: 600px"
      :data="data"
      :props="defaultProps"
      @node-click="LoadCategory"
    />
 
</template>

<style scoped>
</style>